﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="../Frozenui1.3/css/frozen.css" rel="stylesheet" />
    <script src="../JS/zepto.min.js"></script>
    <script src="../Frozenui1.3/js/frozen.js"></script>
    <script src="../JS/MobileCom.js"></script>
    <script src="../JS/avalon.mobile.min.js"></script>
    <title>资料库管理</title>
    <style type="text/css">
        .ui-border {
            padding: 10px;
        }

        .ui-list > li {
            margin: 3px;
        }

        .ui-border {
            background-color: #fff;
        }

            .ui-border .v {
                border-top: solid 1px #ede8e8;
                padding: 5px;
                margin-top: 10px;
                font-size: 12px;
            }

                .ui-border .v span {
                    font-size: 10px;
                    float: right;
                }

        .ui-label-s {
            margin-right: 5px;
        }


        .ms-controller, [ms-controller] {
            display: none;
        }

        #pullDown, #pullUp {
            background: #fff;
            height: 40px;
            line-height: 40px;
            padding: 5px 10px;
            border-bottom: 1px solid #ccc;
            font-weight: bold;
            font-size: 14px;
            color: #888;
        }

            #pullDown .pullDownIcon, #pullUp .pullUpIcon {
                display: block;
                float: left;
                width: 40px;
                height: 40px;
                background: url(../Images/pull-icon@2x.png) 0 0 no-repeat;
                -webkit-background-size: 40px 80px;
                background-size: 40px 80px;
                -webkit-transition-property: -webkit-transform;
                -webkit-transition-duration: 250ms;
            }

            #pullDown .pullDownIcon {
                -webkit-transform: rotate(0deg) translateZ(0);
            }

            #pullUp .pullUpIcon {
                -webkit-transform: rotate(-180deg) translateZ(0);
            }

            #pullDown.flip .pullDownIcon {
                -webkit-transform: rotate(-180deg) translateZ(0);
            }

            #pullUp.flip .pullUpIcon {
                -webkit-transform: rotate(0deg) translateZ(0);
            }

            #pullDown.loading .pullDownIcon, #pullUp.loading .pullUpIcon {
                background-position: 0 100%;
                -webkit-transform: rotate(0deg) translateZ(0);
                -webkit-transition-duration: 0ms;
                -webkit-animation-name: loading;
                -webkit-animation-duration: 2s;
                -webkit-animation-iteration-count: infinite;
                -webkit-animation-timing-function: linear;
            }

        @-webkit-keyframes loading {
            from {
                -webkit-transform: rotate(0deg) translateZ(0);
            }

            to {
                -webkit-transform: rotate(360deg) translateZ(0);
            }
        }
    </style>
</head>
<body ms-controller="wdlist">
    <header class="ui-header ui-header-stable ui-border-b">
        <i ms-if="isback" class="ui-icon-return" onclick="window.history.back()"></i><h1>{{Name}}</h1>
    </header>
    <section class="ui-container">
        <ul class="ui-list ui-list-pure" style="background-color:#f6f0f0;">
            <li class="ui-border ui-label-list" ms-repeat-el="wjjData">
                <a href="javascript:void(0);" ms-click="vieww(el)">
                    <div style="display: -webkit-box;">
                        <div style="padding-right:10px">
                            <img style="height:40px;width:40px" src="../Images/qywd/file1.png" />
                        </div>
                        <div class="ui-list-info">
                            <h4>{{el.Name}}</h4>
                        </div>
                        <!--<div class="ui-list-info">
                        </div>-->
                    </div>
                </a>
            </li>
        </ul>
        <ul class="ui-list ui-list-pure" style="background-color:#f6f0f0;">
            <li class="ui-border ui-label-list" ms-repeat-el="wjData">
                <div style="display: -webkit-box;">
                    <div style="padding-right:10px">
                        <img style="height:40px;width:40px" ms-src="../Images/qywd/{{el.FileExtendName}}.png" />
                    </div>
                    <div class="ui-list-info">
                        <h4 class="ui-nowrap">{{el.Name}}.{{el.FileExtendName}}</h4>
                    </div>
                    <!--<div class="ui-list-info">

                    </div>-->
                </div>
            </li>
        </ul>
        <!--<div id="pullDown" class="loading">
            <span class="pullDownIcon"></span><span class="pullDownLabel">数据加载中...</span>
        </div>-->
        </section>

        <script>
            var strId = MobileCom.getQueryString("id");
            var strname = MobileCom.getQueryString("name");

            document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
                //隐藏右上角按钮
                WeixinJSBridge.call('hideOptionMenu');
            });

            window.localStorage.removeItem("page");
            window.localStorage.setItem("page", 1);

            window.localStorage.removeItem("isjz");
            window.localStorage.setItem("isjz", 0);

            var model = avalon.define({
                $id: "wdlist",
                wjjData: [],
                wjData: [],
                isback:"",
                Name: strname,
                vieww: function (el) {
                    window.location = "UI_WDGL_QYLIST.html?id=" + el.ID + "&name=" + el.Name + "&r=" + Math.random();
                }

            });
            //$(window).scroll(function () {

            //    if ($(document).height() - $(this).scrollTop() - $(this).height() < 40) {
            //        loadMore();
            //    }

            //})

            function loadMore() {
                //var isjz = window.localStorage.getItem("isjz");
                //if (isjz == 0) {
                //    window.localStorage.setItem("isjz", 1);
                //    var page = window.localStorage.getItem("page");

                //    if (page != "0") {
                var conloading = $.loading({
                    content: '正在努力加载中...'
                })

                $.getJSON("/API/WXAPI.ashx?Action=GETLISTDATA&p=" + 1 + "&r=" + Math.random(), { P1: strId }, function (r) {
                    conloading.loading("hide");
                    if (r.ErrorMsg == "") {
                        model.wjjData.pushArray(r.Result);
                        model.wjData.pushArray(r.Result1);
                        //if (r.Result.length > 0) {
                        //    model.ctData.pushArray(r.Result);
                        //    if (r.Result.length < 8) {
                        //        window.localStorage.setItem("page", 0);
                        //        $(".pullDownLabel").text("已加载所有数据");
                        //        $("#pullDown").removeClass("loading");
                        //        $("#pullDown span").eq(0).hide();

                        //    }
                        //    else {
                        //        var page = window.localStorage.getItem("page");
                        //        window.localStorage.setItem("page", parseInt(page) + 1);
                        //    }
                        //} else {
                        //    var page = window.localStorage.getItem("page");
                        //    if (page == "1") {
                        //        $(".pullDownLabel").text("没有数据");
                        //        $("#pullDown").removeClass("loading");
                        //        $("#pullDown span").eq(0).hide();
                        //    }
                        //    else {
                        //        window.localStorage.setItem("page", 0);
                        //        $(".pullDownLabel").text("已加载所有数据");
                        //        $("#pullDown").removeClass("loading");
                        //        $("#pullDown span").eq(0).hide();
                        //    }
                        //}
                    } else {

                    }
                    //window.localStorage.setItem("isjz", 0);
                })
                //    }
                //}
            }
            avalon.ready(function () {
                if (!strId) {
                    strId = "1";
                }
                else {
                    model.isback = "Y";
                }
                if (!strname) {
                    model.Name = "企业资料库";
                }

                loadMore();
            })

        </script>
</body>

</html>
